package com.lwy.springbootdemo01.controller;


import com.lwy.springbootdemo01.bean.Fruit;
import com.lwy.springbootdemo01.service.FruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.sql.DataSource;


@RestController
public class  HelloController {
//    注入druid
    @Autowired
    private DataSource dataSource;

    @Autowired
    private FruitService fruitService;


    @GetMapping("/fruit/{id}")
    @ResponseBody
    public Fruit doquertfruit(@PathVariable String id){
        Fruit querybyig = fruitService.querybyig(id);
        return querybyig;
    }


    //类似RequestMapping() 返回的是get 方法
    @GetMapping("/hello")
    public String hello(){
        System.out.println(dataSource);
        return "hello spring boot";
    }
}
